Update the FAQ and some documentation styles
authorAlex Crichton <alex@alexcrichton.com>
Mon, 17 Nov 2014 22:34:16 +0000 (14:34 -0800)
committerAlex Crichton <alex@alexcrichton.com>
Tue, 18 Nov 2014 22:43:12 +0000 (14:43 -0800)
Closes rust-lang/crates.io#21
Closes rust-lang/crates.io#29
Closes #882

src/doc/faq.md
src/doc/header.html
src/doc/manifest.md
src/doc/stylesheets/all.css

index 5c6e0576ddc1f59e4b209570634cd9152c0375c2..9d4ee66e5405bf6d751c2b53abb9070623527438 100644 (file)
@@ -2,8 +2,8 @@
 
 # Is the plan to use Github as a package repository?
 
-No. The plan for Cargo is to have a central registry of packages, like
-npm or Rubygems.
+No. The plan for Cargo is to use crates.io, like npm or Rubygems do with
+npmjs.org and rubygems.org.
 
 We plan to support git repositories as a source of packages forever,
 because they can be used for early development and temporary patches,
@@ -16,15 +16,14 @@ track the latest Rust. This makes downloading the latest `master` from
 Github the best approach to getting packages at the current point in the
 community's lifecycle.
 
-# Why build a package registry rather than use Github as a registry?
+# Why build crates.io rather than use Github as a registry?
 
 We think that it's very important to support multiple ways to download
 packages, including downloading from Github and copying packages into
 your project itself.
 
-That said, we think that a central registry offers a number of important
-benefits, and will likely become the primary way that people download
-packages in Cargo.
+That said, we think that crates.io offers a number of important benefits, and
+will likely become the primary way that people download packages in Cargo.
 
 For precedent, both Node.js's [npm][1] and Ruby's [bundler][2] support both a
 central registry model as well as a Git-based model, and most packages
@@ -50,6 +49,17 @@ languages include:
   down fast. Also remember that not everybody has a high-speed,
   low-latency Internet connection.
 
+# Why build crates.io before Rust 1.0?
+
+One of Rust's greatest strengths is its thriving community, and Cargo is a key
+tool in helping it grow even further. A central repository like crates.io has
+always been part of Cargo's vision and by building it before Rust 1.0 we're able
+to flesh out bugs and streamline the experience for new 1.0 users.
+
+Crates may have difficulty publishing to the registry in the interim due to the
+language changing, invalidating all previously published versions. This is a
+transitionary pain which will not exist once Rust 1.0 is released.
+
 # Will Cargo work with C code (or other languages)?
 
 Yes!
@@ -58,10 +68,10 @@ Cargo handles compiling Rust code, but we know that many Rust projects
 link against C code. We also know that there are decades of tooling
 built up around compiling languages other than Rust.
 
-Our solution: Cargo allows a package to specify a script to run
-before invoking `rustc`. We plan to add support for platform-specific
-configuration, so you can use `make` on Linux and `cmake` on BSD, for
-example.
+Our solution: Cargo allows a package to [specify a script](build-script.html)
+(written in Rust) to run before invoking `rustc`. Rust is leveraged to
+implement platform-specific configuration and refactor out common build
+functionality among packages.
 
 # Can Cargo be used inside of `make` (or `ninja`, or ...)
 
@@ -78,17 +88,20 @@ will continue to prioritize.
 # Does Cargo handle multi-platform projects or cross-compilation?
 
 Rust itself provides facilities for configuring sections of code based
-on the platform. We plan to support per-platform configuration in
-`Cargo.toml`, including platform-specific dependencies, in the near
-future.
+on the platform. Cargo also supports [platform-specific
+dependencies][target-deps], and we plan to support more per-platform
+configuration in `Cargo.toml` in the future.
+
+[target-deps]: manifest.html#the-[dependencies.*]-sections
 
 In the longer-term, we're looking at ways to conveniently cross-compile
 projects using Cargo.
 
 # Does Cargo support environments, like `production` or `test`?
 
-We are planning on support environments in the near future, that can
-support:
+We support environments through the use of [profiles][profile] to support:
+
+[profile]: manifest.html#the-[profile.*]-sections
 
 * environment-specific flags (like `-g --opt-level=0` for development
   and `--opt-level=3` for production).
@@ -96,11 +109,6 @@ support:
 * environment-specific `#[cfg]`
 * a `cargo test` command
 
-We also plan to make it possible to specify "profiles", which can
-specify flags or dependencies for a combination of multiple environments
-and platforms ("use `fsevents`, but only in OSX in `development` or
-`test`").
-
 # Does Cargo work on Windows?
 
 Yes!
@@ -137,3 +145,19 @@ conflict.
 In other words, libraries specify semver requirements for their dependencies but
 cannot see the full picture. Only end products like binaries have a full
 picture to decide what versions of dependencies should be used.
+
+# Why `Cargo.toml`?
+
+As one of the most frequent interactions with Cargo, the question of why the
+configuration file is named `Cargo.toml` arises from time to time. The leading
+capital-`C` was chosen to ensure that the manifest was grouped with other
+similar configuration files in directory listings. Sorting files often puts
+capital letters before lowercase letters, ensuring files like `Makefile` and
+`Cargo.toml` are placed together. The trailing `.toml` was chosen to emphasize
+the fact that the file is in the [TOML configuration
+format](https://github.com/toml-lang/toml).
+
+Cargo does not allow other names such as `cargo.toml` or `Cargofile` to
+emphasize the ease of how a Cargo repository can be identified. An option of
+many possible names has historically led to confusion where one case was handled
+but others were accidentally forgotten.
index faa5e41997195c23630d0985c87fcdc68c22f6b1..b2c6f8f0243591e9168a3588406ce9bfc612d468 100644 (file)
     </a>
 
     <div class="search">
-        <form action="https://staging-crates-io.herokuapp.com/search"
+        <form action="https://crates.io/search"
               method="GET">
             <input name="q" class="search" placeholder="Search crates" type="text"/>
         </form>
     </div>
 
     <div class="nav">
+        <a href='https://crates.io/crates'>Browse All Crates</a>
+
+        <span class='sep'>|</span>
+
         <div class="dropdown-container">
             <button class="dropdown">
                 Documentation
index 41aaeb4f82614a6ce4382d61d781f0271a507941..9643ed0f972d29b6c983d4c9b5fca47583f997a5 100644 (file)
@@ -26,26 +26,16 @@ basic rules:
 
 ## The `build` Field (optional)
 
-You can specify a script that Cargo should execute before invoking
-`rustc`. You can use this to compile C code that you will [link][1] into
-your Rust code, for example. More information can be found in the building
-non-rust code [guide][2]
+This field specifies a file in the repository which is a [build
+script][1] for building native code. More information can be
+found in the build script [guide][1].
 
-[1]: http://doc.rust-lang.org/reference.html#external-blocks
-[2]: build-script.html
+[1]: build-script.html
 
 ```toml
 [package]
 # ...
-build = "make"
-```
-
-```toml
-[package]
-# ...
-
-# Specify two commands to be run sequentially
-build = ["./configure", "make"]
+build = "build.rs"
 ```
 
 ## The `exclude` Field (optional)
@@ -122,7 +112,24 @@ You can specify the source of a dependency in one of two ways at the moment:
 * `path = "<relative-path>"`: A path relative to the current `Cargo.toml`
   with a `Cargo.toml` in its root.
 
-Soon, you will be able to load packages from the Cargo registry as well.
+Dependencies from crates.io are not declared with separate sections:
+
+```toml
+[dependencies]
+hammer = "0.5.0"
+color = "0.6.0"
+```
+
+Platform-specific dependencies take the same format, but are listed under the
+`target.$triple` section:
+
+```toml
+[target.x86_64-unknown-linux-gnu.dependencies]
+openssl = "1.0.1"
+
+[target.x86_64-pc-windows-gnu.dependencies]
+winhttp = "0.4.0"
+```
 
 # The `[profile.*]` Sections
 
@@ -366,10 +373,10 @@ When you run `cargo test`, Cargo will:
 
 # Configuring a target
 
-Both `[[bin]]` and `[lib]` sections support similar configuration for specifying
-how a target should be built. The example below uses `[lib]`, but it also
-applies to all `[[bin]]` sections as well. All values listed are the defaults
-for that option unless otherwise specified.
+All of the  `[[bin]]`, `[lib]`, `[[bench]]`, and `[[test]]` sections support
+similar configuration for specifying how a target should be built. The example
+below uses `[lib]`, but it also applies to all other sections as well. All
+values listed are the defaults for that option unless otherwise specified.
 
 ```toml
 [package]
@@ -388,7 +395,7 @@ path = "src/lib.rs"
 test = true
 
 # A flag for enabling documentation tests for this target. This is only
-# relevant for libraries, it has no effect on [[bin]] sections. This is used by
+# relevant for libraries, it has no effect on other sections. This is used by
 # `cargo test`.
 doctest = true
 
index bbb3f666c195c27622b761f9b2089bb1f0cb0eb0..6c59e53a41449188059264ea4c5ed66f28faa32f 100644 (file)
@@ -154,11 +154,9 @@ footer a {
 footer a:hover {
     color: #e6e6e6;
 }
-footer .sep, #header .sep {
-    margin: 0 10px;
-    color: #284725;
-}
-
+footer .sep, #header .sep { color: #284725; }
+footer .sep { margin: 0 10px; }
+#header .sep { margin-left: 10px; }
 
 .headerlink {
   display: none;
@@ -239,6 +237,11 @@ button {
     color: white;
 }
 
+button.active {
+  background:#2a4f27;
+  box-shadow:inset -2px 2px 4px 0 #243d26
+}
+
 ul.dropdown {
     display: none;
     visibility: none;